from defs import *

class GameMessage(pygame.sprite.Sprite):

   message = ""
   isCentre = True
   isTop = False
   isLeft = False
   isRight = False
   counter = 0
    
   def __init__(self):
      pygame.sprite.Sprite.__init__(self)
      self.font = pygame.font.Font(None, FONT_SIZE)
        
   def update(self):
      #if (self.counter == 0):
      if (self.isCentre):
         self.image = self.font.render(self.message, True, (255, 255, 255))
         self.rect = self.image.get_rect(center=SCREENRECT.center)
         
         if (self.isLeft):
            print (SCREENRECT.width/4)
            self.rect.centerx = SCREENRECT.width/4
         elif (self.isRight):
            print (SCREENRECT.width - (SCREENRECT.width/4))
            self.rect.centerx = SCREENRECT.width - (SCREENRECT.width/4)
         elif (self.isTop):
            self.rect.centery = OTHER_YPOS
         
      elif (self.counter > 0):
         jumpMessage = 'Powerup: ' + '-'*self.counter
         self.image = self.font.render(jumpMessage, True, (255, 255, 255))
         self.rect = self.image.get_rect(center=SCREENRECT.center)
         self.rect.bottom = SCREENRECT.height
      else:
         self.image = self.font.render(self.message, True, (255, 255, 255))
         self.rect = self.image.get_rect(center=SCREENRECT.center)
         self.rect.bottom = SCREENRECT.height - OTHER_YPOS
         